#!/usr/bin/env python3

from ruamel.yaml import YAML

yaml = YAML()
yaml.default_flow_style = False
yaml.pure = True
yaml.indent(mapping=2, sequence=2, offset=2)

with open('snap/snapcraft.yaml', 'r') as fp:
    udi_data = yaml.load(fp)

with open('vendor/ubuntu-desktop-provision/packages/subiquity_client/subiquity/snapcraft.yaml', 'r') as fp:
    subiquity_data = yaml.load(fp)

for part in ('probert', 'curtin'):
    udi_data['parts'][part]['source-commit'] = \
        subiquity_data['parts'][part]['source-commit']

with open('snap/snapcraft.yaml', 'w') as fp:
    yaml.dump(udi_data, fp)
